<!--本页面由uniapp切片工具生成，uni-app切片-可视化设计工具(一套代码编译到7个平台iOS、Android、H5、小程序)，软件下载地址：http://www.ymznkf.com/new_view_669.htm -->
<template>
	<view class="YmContent">
		<view class="application_for_withdrawal_71">
			<text decode="true" class="application_for_withdrawal_74" style="width: 300rpx;">请输入充值金额</text>
			<view class="application_for_withdrawal_75">
				<text decode="true" class="application_for_withdrawal_76">￥</text>
				<input v-model="money" style="color: #000000;" class="application_for_withdrawal_77" />
			</view>
			<view class="application_for_withdrawal_81">
				<text decode="true" class="application_for_withdrawal_82"
					style="width: 600rpx;">充值会有1-3分钟延迟，如有疑问联系客服</text>
				<text decode="true" class="application_for_withdrawal_83"></text>
			</view>

			<button v-on:click="beforehandPay()" class="btSubmit">确认充值</button>
		</view>

		<view class="ymBbottom"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				money: "",
				payType: -1,
				payRecord: {}
			}
		},
		onLoad() {

		},
		methods: {

			beforehandPay() {
				if (!this.money) {
					uni.showToast({
						title: "输入充值金额",
						icon: 'none'
					});
					return;
				}
				this.$http('integral.beforehandPay', {
					token: this.$tools.getToken(),
					money: Number(this.money * 100),
				}).then(res => {
					console.log('res', res)
					if (res.code == 200) {
						this.toPayHtml(res.data.payRecord)
					}
					uni.hideLoading()
				})
			},
			toPayHtml(orderNumber) {
				uni.showLoading({
					title: '请稍等',
					mask: true
				})
				this.$http('order.payBalance', {
					token: this.$tools.getToken(),
					payNumber: orderNumber.pay_number
				}).then(res => {
					console.log('res',res)
					if (res.code == 200) {
						var AtimeStamp = res.data.timeStamp;
						var AnonceStr = res.data.nonceStr;
						var Apackage = res.data.package;
						var ApaySign = res.data.paySign;
						wx.requestPayment({
							'timeStamp': AtimeStamp,
							'nonceStr': AnonceStr,
							'package': Apackage,
							'signType': 'MD5',
							'paySign': ApaySign,
							'success': function(res) {
								uni.showToast({
									title: '支付成功',
									icon: "none"
								})
								setTimeout(res => {
									uni.navigateBack()
								}, 500)
							},
							'fail': function(res) {
								uni.showToast({
									title: '取消支付',
									icon: "none"
								})

							},
							'complete': function(res) {}
						})
					}
				})
			},
			getPayAlipayForm() {
				// #ifdef APP-PLUS

				uni.navigateTo({
					url: "../../pay/payWebView/payWebView?url=" + this.domainName +
						"#/pages/pay/payRich/payRich?payNumber=" + this.payRecord.payNumber
				})
				// #endif

				// #ifdef H5
				window.location.href = this.domainName + "#/pages/pay/payRich/payRich?payNumber=" + this.payRecord
					.payNumber + "&token=" + uni.getStorageSync("token")
				// #endif

				return;
				uni.showLoading({
					title: '请稍等...'
				});
				uni.request({
					url: this.serviceUrl + 'app-yijiu-member/getPayAlipayForm',
					method: 'POST',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					data: {
						token: uni.getStorageSync("token"),
						payNumber: this.payRecord.payNumber
					},
					success: res => {
						if (res.data.code == 200) {
							var formHtml = res.data.data.form;

							uni.setStorageSync("formHtml", formHtml)
							uni.navigateTo({
								url: "../../pay/payRich/payRich"
							})

						} else {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							});
						}
					},
					fail: res => {
						uni.showToast({
							title: '网络错误！',
							icon: 'none'
						});
					},
					complete() {
						uni.hideLoading();
					}
				});
			}

		}
	}
</script>

<style>
	html,
	body,
	#app {
		height: 100%;
		width: 100%;
	}

	.YmContent {
		height: 100%;
		width: 100%;
	}

	uni-page-body,
	#app {
		height: 100%;
	}

	button::after {
		border: none;
		width: auto;
	}

	input {
		outline: none;
		border: none;
		list-style: none;
		width: auto;
	}

	.list_item {
		float: left;
	}

	.ym_hide {
		display: none;
	}

	.ym_show {
		display: block;
	}

	.slide-image {
		width: 100%;
		height: 100%;
	}

	.list_horizontal {
		width: auto;
		display: inline-block;
	}

	.application_for_withdrawal_71 {
		white-space: normal;
		width: 749upx;
		height: 100%;
		padding: 0upx;
		clear: both;
		float: left;
		background-color: #ffffff;
		border-radius: 0upx;
		font-size: 8upx;

	}

	.application_for_withdrawal_71 .application_for_withdrawal_74 {
		white-space: normal;
		width: 181upx;
		height: 34upx;
		padding: 0upx;
		clear: both;
		margin-top: 30upx;
		margin-left: 34upx;
		float: left;
		border-radius: 0upx;
		color: #646464;
		font-size: 32upx;
		line-height: 34upx;
	}

	.application_for_withdrawal_71 .application_for_withdrawal_75 {

		width: 647upx;
		height: 66upx;
		/* padding: 0upx; */
		clear: both;
		margin-top: 68upx;
		margin-left: 34upx;
		float: left;
		border-radius: 0upx;
		font-size: 43upx;
		display: flex;
		flex-direction: row;
		align-items: center;
		padding-bottom: 24rpx;
		border-bottom: 1rpx solid #c8c8c8;
	}

	.application_for_withdrawal_71 .application_for_withdrawal_75 .application_for_withdrawal_76 {
		white-space: normal;

		height: 66upx;
		padding: 0upx;
		margin-top: 0upx;
		margin-left: 0upx;
		float: left;
		border-radius: 0upx;
		color: #646464;
		font-size: 43upx;
		margin-top: 10rpx;


	}

	.application_for_withdrawal_71 .application_for_withdrawal_75 .application_for_withdrawal_77 {
		white-space: normal;

		height: 66upx;
		padding: 0upx;
		margin-top: 0upx;
		margin-left: 25upx;
		float: left;
		border-radius: 0upx;
		color: #c8c8c8;
		font-size: 43upx;


	}

	.application_for_withdrawal_71 .application_for_withdrawal_81 {
		white-space: normal;
		width: 704upx;
		height: 36upx;
		padding: 0upx;
		clear: both;
		margin-top: 85upx;
		margin-left: 32upx;
		float: left;
		border-radius: 0upx;
		font-size: 29upx;
		line-height: 36upx;

	}

	.application_for_withdrawal_71 .application_for_withdrawal_81 .application_for_withdrawal_82 {
		white-space: normal;
		width: 377upx;
		height: 36upx;
		padding: 0upx;
		margin-top: 0upx;
		margin-left: 0upx;
		float: left;
		border-radius: 0upx;
		color: #c8c8c8;
		font-size: 29upx;
		line-height: 36upx;
	}

	.application_for_withdrawal_71 .application_for_withdrawal_81 .application_for_withdrawal_83 {
		white-space: normal;
		width: 128upx;
		height: 36upx;
		padding: 0upx;
		margin-top: 0upx;
		margin-left: 186upx;
		float: left;
		border-radius: 0upx;
		color: #ff4342;
		font-size: 29upx;
		line-height: 36upx;
	}

	.application_for_withdrawal_71 .payType {
		white-space: normal;
		width: 683upx;
		height: 50upx;
		padding: 0upx;
		clear: both;
		margin-top: 64upx;
		margin-left: 33upx;
		float: left;
		border-radius: 0upx;
		font-size: 49upx;
		line-height: 50upx;
	}

	.application_for_withdrawal_71 .payType .application_for_withdrawal_85 {
		white-space: normal;
		width: 46upx;
		height: 47upx;
		padding: 0upx;
		margin-top: 3upx;
		margin-left: 2upx;
		float: left;
		border-radius: 0upx;
		font-size: 48upx;
		line-height: 47upx;
	}

	.application_for_withdrawal_71 .payType .application_for_withdrawal_86 {
		white-space: normal;
		width: 81upx;
		height: 28upx;
		padding: 0upx;
		margin-top: 11upx;
		margin-left: 23upx;
		float: left;
		border-radius: 0upx;
		color: #646464;
		font-size: 27upx;
		line-height: 28upx;
	}

	.application_for_withdrawal_71 .payType .application_for_withdrawal_87 {
		white-space: normal;
		width: 43upx;
		height: 44upx;
		padding: 0upx;
		margin-top: 2upx;
		margin-left: 4upx;
		float: left;
		border-radius: 0upx;
		font-size: 43upx;
		line-height: 44upx;
	}

	.application_for_withdrawal_71 .payType .application_for_withdrawal_88 {
		white-space: normal;
		width: 47upx;
		height: 47upx;
		padding: 0upx;
		margin-top: 3upx;
		margin-left: 105upx;
		float: left;
		border-radius: 0upx;
		font-size: 49upx;
		line-height: 47upx;
	}

	.application_for_withdrawal_71 .payType .application_for_withdrawal_89 {
		white-space: normal;
		width: 81upx;
		height: 29upx;
		padding: 0upx;
		margin-top: 11upx;
		margin-left: 22upx;
		float: left;
		border-radius: 0upx;
		color: #646464;
		font-size: 27upx;
		line-height: 29upx;
	}

	.application_for_withdrawal_71 .payType .application_for_withdrawal_90 {
		white-space: normal;
		width: 43upx;
		height: 43upx;
		padding: 0upx;
		margin-top: 3upx;
		margin-left: 11upx;
		float: left;
		border-radius: 0upx;
		font-size: 42upx;
		line-height: 43upx;
	}

	.application_for_withdrawal_71 .btSubmit {
		white-space: normal;
		width: 679upx;
		height: 92upx;
		padding: 0upx;
		clear: both;
		margin-top: 63upx;
		margin-left: 35upx;
		float: left;
		background: linear-gradient(128.5deg, #fae568 0%, #ffc82f 100%), linear-gradient(135.25deg, #f8dc59 0%, #f6bc57 100%), #cccccc;
		text-align: center;
		justify-content: center;
		border-radius: 10upx;
		cursor: pointer;
		color: #ffffff;
		font-size: 27upx;
		line-height: 92upx;
	}

	.application_for_withdrawal_71 .btSubmit_label {
		float: left;
	}

	.application_for_withdrawal_71 .btSubmit_button {
		float: left;
		color: #000000;
		font-size: 30rpx;
		text-align: center;
		line-height: 30rpx;
		border-color: #e1e1e1;
		border-width: 1rpx;
		border-style: solid;
		border-radius: 5rpx;
		padding: 10rpx;
		margin: 15rpx;
	}

	.application_for_withdrawal_71 .btSubmit_button_select {
		float: left;
		color: #ff8000;
		font-size: 30rpx;
		text-align: center;
		line-height: 30rpx;
		border-color: #ff8000;
		border-width: 1rpx;
		border-style: solid;
		border-radius: 5rpx;
		padding: 10rpx;
		margin: 15rpx;
	}

	.application_for_withdrawal_71 .btSubmit_title {
		float: left;
	}
</style>
